package view.components
{
	import flash.display.Sprite;
	import flash.events.Event;
	import flash.events.MouseEvent;
	
	import scaleform.clik.controls.Button;
	import scaleform.clik.controls.Label;
	import scaleform.clik.controls.TextArea;

	public class LogWindow extends Sprite{
		
		public var logTitle:Label;
		public var logView:TextArea;
		public var clearLogBtn:Button;
		
		public function LogWindow(){
			addEventListener(Event.ADDED_TO_STAGE,onAddedtoStage);
		}
		
		protected function onAddedtoStage(event:Event):void{
			clearLogBtn.addEventListener(MouseEvent.CLICK,onClick);
		}
		
		protected function onClick(event:MouseEvent):void{
			logView.htmlText = '';
		}
		
		public function log(message:String):void{
			logView.appendHtml(message + "<br>");
			trace(message);
		}
		
		public function error(message:String):void{
			logView.appendHtml("<font color='#FF0000'>" + message + "</font><br>");
			trace(message);
		}
	}
}